package com.web.controller;

import com.web.bean.系性别人数;
import com.web.dao.系性别统计人数;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/getxisex")
public class queryXibysex extends HttpServlet {
    @Override           //req请求对象                           resp响应对象
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {


        //1、调用数据库的操作方法查询集合数据
        系性别统计人数 dao = new 系性别统计人数();
        List<系性别人数> list = dao.queryxisex();
        //2、将集合数据保存在作用域中【容器】
        req.setAttribute("list", list);
        //3、跳转页面
        req.getRequestDispatcher("/xisexIndex.jsp").forward(req, resp);
    }

    //doPost用于处理post请求方式
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req, resp);
    }
}
